package com.linchong.concurrency.publish;

import com.linchong.concurrency.annoations.UnRecommend;
import com.linchong.concurrency.annoations.UnThreadSafe;
import lombok.extern.slf4j.Slf4j;

/**
 * @author linchong
 * @version 1.0
 * @Date: 2020-12-08 17:19
 * @Description: Escape$
 */
@Slf4j
@UnThreadSafe
@UnRecommend
public class Escape {

	private int thisCanBeEscape = 0;

	public Escape(){
		new InnerClass();
	}

	private class InnerClass{
		//发布逸出，对象构造完成之间被其他线程可见
		//对象未完成构造之前，不可以将其发布
		public InnerClass(){
			log.info("{}",Escape.this.thisCanBeEscape);
		}
	}

	public static void main(String[] args) {
		new Escape();
	}
}
